<#assign module="marketing"/>

<@override name="header">
</@override>
<@override name="body">

	<div class="row">
		<div class="col-xs-10">
		  	<div class="btn-group">
			  <a class="btn btn-default" href="${ctx}/weixinmanager/list">客户经理</a>
			  <a class="btn btn-default" href="${ctx}/weixinmanager/agreement">合作协议</a>
			  <a class="btn btn-default active" href="${ctx}/weixinmanager/tixian">提现审核 <span class="label label-danger" id="wait_audit_label"></span></a>
			</div>
		</div>
	</div>
		
		
	<div class="row margin-top">
		<div class="col-xs-12">
			<form class="form-inline" role="form">
			
			  	<div class="form-group">
			  		<input type="text" class="form-control" style="width:250px;" name="param" value="${param?if_exists}" placeholder="微信号/姓名/手机号">
			  	</div>
				
			  	<button id="search_button" type="submit" class="btn btn-primary"><i class="icon-search"></i>&nbsp;搜索</button>
			</form>
		</div>
	</div>

	<div class="row margin-top">
		<div class="col-xs-12">
		<div class="table-responsive">
		<div class="panel panel-primary">
			<table class="table table-hover table-striped">
				<thead>
				<tr style="font-size:14px;">
					<th>状态</th>
					<th>姓名</th>
					<th>电话</th>
					<th>微信号</th>
					<th>提现时间</th>
					<th>金额(元)</th>
					<th>提现后余额(元)</th>
					<th>微信订单号</th>
					<th>微信支付成功时间</th>
					<th>操作人</th>
					<th>操作</th>
				</tr>
				</thead>
				<tbody>
					<#if (page.content)?? >
				  	<#list page.content as data>
						<tr>
							<td>
								<#if data.status==0>
									<span class="label label-info status-td">未审核</span>
								<#elseif data.status==1>
									<span class="label label-success status-td">已通过</span>
								<#elseif data.status==2>
									<span class="label label-danger status-td">已驳回</span>
								</#if>
							</td>
							<td>${data.managerName?if_exists}</td>
							<td>${data.managerPhone?if_exists}</td>
							<td>${data.managerWxAccount?if_exists}</td>
							<td>${data.created?string("yyyy-MM-dd HH:mm:ss")}</td>
							<td><span style="color:#ff950b;font-weight:700;">${data.money?if_exists}</span></td>
							<td><span style="color:#ff950b;font-weight:700;">${data.afterMoney?if_exists}</span></td>
							<td>${data.paymentNo?if_exists}</td>
							<td>
								<#if data.paymentTime??>
									${data.paymentTime?string("yyyy-MM-dd HH:mm:ss")}
								</#if>
							</td>
							<td>${data.operating?if_exists}</td>
							<td>
								<#if data.status==0>
									<a href="javascript:;" data-value="${data.id}" class="btn-link access">通过</a>
									<a href="javascript:;" data-value="${data.id}" class="btn-link cancel">驳回</a>
								</#if>
							</td>
						</tr>
					</#list>
					</#if>
				</tbody>
			</table>
			<#if page.totalElements??>
			<ul class="pagination pull-right pagination-sm">
				<li><a>共 ${page.totalElements} 条数据</a></li>
				<@pg.pager items=page.totalElements?number maxPageItems=20 export="currentPageNumber=pageNumber" url="${ctx}/weixinmanager/tixian">
					<@pg.param name="param" value="${param?if_exists}"/>
					<@pg.index>
						<@pg.first>
							<li><a href="${pageUrl}">&laquo;</a></li>
						</@pg.first>
						<@pg.prev>
							<li><a href="${pageUrl}">&lsaquo;</a></li>
						</@pg.prev>
						<@pg.pages>
							<#if  currentPageNumber == pageNumber >
								<li class="active"><a href="#">${pageNumber}</a></li>
							<#else>
								<li><a href="${pageUrl}">${pageNumber}</a></li>
							</#if>
						</@pg.pages>
						<@pg.next>
							<li><a href="${pageUrl}">&rsaquo;</a></li>
						</@pg.next>
						<@pg.last>
							<li><a href="${pageUrl}">&raquo;</a></li>
						</@pg.last>
					</@pg.index>
				</@pg.pager>
			</ul>
			</#if>
		</div>
		</div>
		</div>
	</div>
	

</@override>
<@override name="footer">
<script src="${ctx}/assets/js/weixinmanager/managercommon.js"></script>
<script type="text/javascript">
	var thisButton;
	
	function accessTixian() {
	    $.post('${ctx}/weixinmanager/tixian',{'id':thisButton.attr("data-value"),'status':1},function(data){
	            if(data.success){
	                $.scojs_message('提现成功', $.scojs_message.TYPE_OK);
	                if(null!=data.errorcode && data.errorcode!="ok"){
    					alert("暂无法发送微信消息，错误："+data.errorcode);
		    		}
	                setTimeout(function(){
			    		window.location.reload(true);
			    	}, 1000);//1s
	            } else {
	                $.scojs_message(data.message, $.scojs_message.TYPE_ERROR);
	            }
	    },'json');
	}
	
	function cancelTixian() {
	    $.post('${ctx}/weixinmanager/tixian',{'id':thisButton.attr("data-value"),'status':2},function(data){
	            if(data.success){
	                $.scojs_message('操作成功', $.scojs_message.TYPE_OK);
	                if(null!=data.errorcode && data.errorcode!="ok"){
    					alert("暂无法发送微信消息，错误："+data.errorcode);
		    		}
		    		setTimeout(function(){
			    		window.location.reload(true);
			    	}, 1000);//1s
	            } else {
	                $.scojs_message(data.message, $.scojs_message.TYPE_ERROR);
	            }
	    },'json');
	}
	
	$(document).ready(function(){
	
		$(".access").click(function(){
	          thisButton = $(this);
	          
	          var confirm = $.scojs_confirm({
	            content: "确认要审核通过该申请吗？",
	            action:accessTixian
	          });
	          confirm.show();
	    });
	    
	    $(".cancel").click(function(){
	          thisButton = $(this);
	          
	          var confirm = $.scojs_confirm({
	            content: "确认要驳回该申请吗？",
	            action:cancelTixian
	          });
	          confirm.show();
	    });
	});
</script>
</@override>
<@extends name="../layout.ftl"/>